package com.hibernate.model;

import java.util.LinkedHashMap;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.javacommon.base.BaseEntity;
import org.hibernate.validator.constraints.Length;

/**
 * 
 */

@Entity
@Table(name = "MEDIA_VOUCHER")
public class MediaVoucher extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	public final static Map<String, String> PROGRESS = new LinkedHashMap<String, String>();
	
	static{
		PROGRESS.put("true", "审核通过");
		PROGRESS.put("false", "未审核");
	}
	
	//alias
	public static final String TABLE_ALIAS = "媒体结算";
	public static final String ALIAS_ID = "编号";
	public static final String ALIAS_MEDIA_NAME = "媒体名称";
	public static final String ALIAS_MEDIA_ID = "媒体ID";
	public static final String ALIAS_AD_PLACE_NAME = "广告位名称";
	public static final String ALIAS_AD_PLACE_ID = "广告位ID";
	public static final String ALIAS_PV = "PV";
	public static final String ALIAS_UV = "UV";
	public static final String ALIAS_CLICK_UV = "点击UV";
	public static final String ALIAS_CLICK_PV = "点击PV";
	public static final String ALIAS_LOG_DATE = "日期";
	public static final String ALIAS_HAS_AUDIT = "是否已审核";
	public static final String ALIAS_BY_PV = "byPv";
	public static final String ALIAS_BY_UV = "byUv";
	public static final String ALIAS_BY_CLICK_UV = "byClickUv";
	
	//date formats
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * id       db_column: ID 
     */ 	
	
	private java.lang.Long id;
    /**
     * 媒体名称       db_column: MEDIA_NAME 
     */ 	
	@Length(max=1000)
	private java.lang.String mediaName;
    /**
     * 媒体ID       db_column: MEDIA_ID 
     */ 	
	
	private java.lang.Long mediaId;
    /**
     * 广告位名称       db_column: AD_PLACE_NAME 
     */ 	
	@Length(max=1000)
	private java.lang.String adPlaceName;
    /**
     * 广告位ID       db_column: AD_PLACE_ID 
     */ 	
	
	private java.lang.Long adPlaceId;
    /**
     * PV       db_column: PV 
     */ 	
	
	private java.lang.Long pv;
    /**
     * UV       db_column: UV 
     */ 	
	
	private java.lang.Long uv;
    /**
     * 点击UV       db_column: CLICK_UV 
     */ 	
	
	private java.lang.Long clickUv;
    /**
     * 点击PV       db_column: CLICK_PV 
     */ 	
	
	private java.lang.Long clickPv;
    /**
     * 记录时间       db_column: LOG_DATE 
     */ 	
	@Length(max=20)
	private java.lang.String logDate;
    /**
     * 是否已审核       db_column: HAS_AUDIT 
     */ 	
	
	private java.lang.Boolean hasAudit;
    /**
     * byPv       db_column: BY_PV 
     */ 	
	
	private java.lang.Boolean byPv;
    /**
     * byUv       db_column: BY_UV 
     */ 	
	
	private java.lang.Boolean byUv;
    /**
     * byClickUv       db_column: BY_CLICK_UV 
     */ 	
	
	private java.lang.Boolean byClickUv;
	//columns END


	public MediaVoucher(){
	}

	public MediaVoucher(
		java.lang.Long id
	){
		this.id = id;
	}

	

	public void setId(java.lang.Long value) {
		this.id = value;
	}
	
	@Id
	@GeneratedValue(generator = "paymentableGenerator")       
	@GenericGenerator(name = "paymentableGenerator", strategy = "native") 
	@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Long getId() {
		return this.id;
	}
	
	@Column(name = "MEDIA_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 1000)
	public java.lang.String getMediaName() {
		return this.mediaName;
	}
	
	public void setMediaName(java.lang.String value) {
		this.mediaName = value;
	}
	
	@Column(name = "MEDIA_ID", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Long getMediaId() {
		return this.mediaId;
	}
	
	public void setMediaId(java.lang.Long value) {
		this.mediaId = value;
	}
	
	@Column(name = "AD_PLACE_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 1000)
	public java.lang.String getAdPlaceName() {
		return this.adPlaceName;
	}
	
	public void setAdPlaceName(java.lang.String value) {
		this.adPlaceName = value;
	}
	
	@Column(name = "AD_PLACE_ID", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Long getAdPlaceId() {
		return this.adPlaceId;
	}
	
	public void setAdPlaceId(java.lang.Long value) {
		this.adPlaceId = value;
	}
	
	@Column(name = "PV", unique = false, nullable = true, insertable = true, updatable = true, length = 18)
	public java.lang.Long getPv() {
		return this.pv;
	}
	
	public void setPv(java.lang.Long value) {
		this.pv = value;
	}
	
	@Column(name = "UV", unique = false, nullable = true, insertable = true, updatable = true, length = 18)
	public java.lang.Long getUv() {
		return this.uv;
	}
	
	public void setUv(java.lang.Long value) {
		this.uv = value;
	}
	
	@Column(name = "CLICK_UV", unique = false, nullable = true, insertable = true, updatable = true, length = 18)
	public java.lang.Long getClickUv() {
		return this.clickUv;
	}
	
	public void setClickUv(java.lang.Long value) {
		this.clickUv = value;
	}
	
	@Column(name = "CLICK_PV", unique = false, nullable = true, insertable = true, updatable = true, length = 18)
	public java.lang.Long getClickPv() {
		return this.clickPv;
	}
	
	public void setClickPv(java.lang.Long value) {
		this.clickPv = value;
	}
	
	@Column(name = "LOG_DATE", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
	public java.lang.String getLogDate() {
		return this.logDate;
	}
	
	public void setLogDate(java.lang.String value) {
		this.logDate = value;
	}
	
	@Column(name = "HAS_AUDIT", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
	public java.lang.Boolean getHasAudit() {
		return this.hasAudit;
	}
	
	public void setHasAudit(java.lang.Boolean value) {
		this.hasAudit = value;
	}
	
	@Column(name = "BY_PV", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
	public java.lang.Boolean getByPv() {
		return this.byPv;
	}
	
	public void setByPv(java.lang.Boolean value) {
		this.byPv = value;
	}
	
	@Column(name = "BY_UV", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
	public java.lang.Boolean getByUv() {
		return this.byUv;
	}
	
	public void setByUv(java.lang.Boolean value) {
		this.byUv = value;
	}
	
	@Column(name = "BY_CLICK_UV", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
	public java.lang.Boolean getByClickUv() {
		return this.byClickUv;
	}
	
	public void setByClickUv(java.lang.Boolean value) {
		this.byClickUv = value;
	}
	

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("MediaName",getMediaName())
			.append("MediaId",getMediaId())
			.append("AdPlaceName",getAdPlaceName())
			.append("AdPlaceId",getAdPlaceId())
			.append("Pv",getPv())
			.append("Uv",getUv())
			.append("ClickUv",getClickUv())
			.append("ClickPv",getClickPv())
			.append("LogDate",getLogDate())
			.append("HasAudit",getHasAudit())
			.append("ByPv",getByPv())
			.append("ByUv",getByUv())
			.append("ByClickUv",getByClickUv())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof MediaVoucher == false) return false;
		if(this == obj) return true;
		MediaVoucher other = (MediaVoucher)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
	@Transient
	@Override
	public String getTarget() {
		// TODO Auto-generated method stub
		return "MediaVoucher";
	}
	@Transient
	@Override
	public Long getTargetId() {
		// TODO Auto-generated method stub
		return getId();
	}
	@Transient
	@Override
	public String getTargetName() {
		// TODO Auto-generated method stub
		return "MEDIA_VOUCHER"+getId();
	}
}
